package com.tjb.controller;

import com.tjb.Entity.UserUploadInfo;
import com.tjb.service.impl.ExportImpl;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/export")
@Slf4j
public class ExportController {

    @Autowired
    private ExportImpl export;


    @GetMapping("/exportFile")
    public void exportFile() {
            new Thread(new Runnable() {
                @SneakyThrows
                @Override
                public void run() {
                    Thread thread1 = Thread.currentThread();
                    UserUploadInfo sysUserUploadInfo =new UserUploadInfo();
                    sysUserUploadInfo.setUserName(thread1.getName());

                    export.export(sysUserUploadInfo);
                }
            }).start();
        }
}